/*
 * @Author: fhw
 * @Date: 2022-07-04 11:34:45
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-03-28 22:34:26
 * @Description:
 */
/**
 * @user: antes
 * @emial: tangzhlyd@gmail.com
 * @data: 2020/8/13 下午4:11
 */
import { forEach, keys } from 'ramda'
export interface Config {
	readonly [index: string]: { [index: string]: string | number }
}
export const optObject: Config = {
	flag: {
		1: '隐藏',
		2: '显示',
	},
	flag1: {
		1: '是',
		2: '否',
	},
	genderStatus: {
		1: '男', 2: '女'
	},
	status: {
		enabled: '启用',
		disabled: '禁用',
	},
	/** 用户状态 */
	userStatus: {
		1: '正常',
		2: '拉黑'
	},
	pageType: {
		1: '导航',
		2: '页面'
	},
	coupleStatus: {
		pending: '邀请中',
		confirmed: '已确认关系',
		broken_up: '分手',
		REJECTED: '已拒绝',
		marry: '结婚',
	},
	lang: {
		ar: '阿拉伯语',    // Arabic
		de: '德语',       // German
		en: '英语',       // English
		es: '西班牙语',    // Spanish
		fr: '法语',       // French
		in: '印尼语',      // Indonesian
		ko: '韩语',       // Korean
		pt: '葡萄牙语',    // Portuguese
		th: '泰语',       // Thai
		zh: '中文（繁体）',  // Chinese (Traditional)
		zhHans: '中文（简体）' // Chinese (Simplified)
	},
	freeType: {
		1: '免费',
		2: '收费'
	},
	jumpType: {
		10: '不跳转',
		20: '文章',
		30: '电影',
		40: '外链接',
	}
}

function getOptions(data: Config): { [index: string]: Array<OptionsValue> } {
	const _obj: { [index: string]: Array<OptionsValue> } = {}
	forEach((key) => {
		const list: Array<OptionsValue> = []
		const item = data[key]
		forEach((key) => {
			const a = Number(key)
			list.push({
				value: isNaN(a) ? key : a,
				label: item[key],
			})
		}, keys(item))
		_obj[key] = list
	}, keys(data))
	return _obj
}
export const options = getOptions(optObject)
export interface OptionsValue {
	value: string | number
	label: string | number
}
